define([
  'jquery',
  'jqueryui',
  'underscore',
  'backbone',
  'text!templates/search/searchResultsTemplate.html',
], function($,ui, _, Backbone,  searchResultsTemplate){

  var SearchResultsView = Backbone.View.extend({
    initialize: function(){
    },
//    events: {'click .takeappointment' : 'takeappointment'} ,
    render: function(){
    	var data = {
    		  results: this.collection.models,
    	        _: _ 
    	      };
    	self=this;
	      var compiledTemplate = _.template( searchResultsTemplate, data );
	      $("#searchresults").html(compiledTemplate);
	      $('.takeappointment').click(function(event) {
	    	  self.doctorId =$(this).attr("data");
	    	  self.hospitalId =$(this).attr("hospital");
	    	  self.goTo("takeappointment");
	      });
    }
   });

  return SearchResultsView;
});
